import client.Client;
import client.ClientServer;
import client.ClientTracker;
import utils.ClientConfiguration;
import utils.SavedData;

public class PonyToPony {
	public static void main (String argv[]) throws Exception{
		ClientConfiguration configClient = new ClientConfiguration();
		Client c = new Client(configClient);
		SavedData.loadIn(c);
//		System.out.println("Leeches :");
//		for(int i = 0; i<c.getMyLeech().size();i++){
//			System.out.println(c.getMyLeech().get(i).toString());
//		}
//		System.out.println("Seeds :");
//		for(int i = 0; i<c.getMySeed().size();i++){
//			System.out.println(c.getMySeed().get(i).toString());
//		}

		
		System.err.println("Client IP : "+ configClient.getIpClient()+":"+configClient.getPortClient());
		System.err.println("Connection to Tracker : "+ configClient.getIpTracker()+":"+configClient.getPortTracker());
		ClientServer cs = new ClientServer(configClient.getPortClient(), c);
		ClientTracker ct = new ClientTracker(configClient.getIpTracker(), configClient.getPortTracker(), c, cs);
	//	SavedData.clear();
		//Sauvegarde toutes les seeds du client
		for(int i = 0; i< c.getMySeed().size(); i ++)
			SavedData.save(c.getMySeed().get(i));
	}
}
